
datablock AudioProfile(CorsairShotSound)
{
   filename    = "./CorsairCannonFire.wav";
   description = AudioClose3d;
   preload = true;
};

datablock AudioProfile(CorsairBulletHit)
{
   filename    = "./CorsairBulletHit.wav";
   description = AudioClose3d;
   preload = true;
};

datablock AudioProfile(CorsairBombDropSound)
{
   filename    = "./CorsairBombDrop.wav";
   description = AudioClose3d;
   preload = true;
};

datablock ProjectileData(CorsairBombProjectile)
{
   projectileShapeName = "./CorsairBomb.dts";
   directDamage        = 500;
   directDamageType = $DamageType::TankShellDirect;
   radiusDamageType = $DamageType::TankShellRadius;
   impactImpulse	   = 1000;
   verticalImpulse	   = 1000;
   explosion		= CorsairBombExplosion;
   //explosion           = TankShellExplosion;
   //particleEmitter     = rocketTrailEmitter;

   brickExplosionRadius = 10;
   brickExplosionImpact = true;          //destroy a brick if we hit it directly?
   brickExplosionForce  = 50;             
   brickExplosionMaxVolume = 60;          //max volume of bricks that we can destroy
   brickExplosionMaxVolumeFloating = 120;  //max volume of bricks that we can destroy if they aren't connected to the ground (should always be >= brickExplosionMaxVolume)

   muzzleVelocity      = 0;
   velInheritFactor    = 1.0;

   armingDelay         = 0;
   lifetime            = 7500;
   fadeDelay           = 7500;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = true;
   gravityMod = 1.0;

   hasLight    = true;
   lightRadius = 5.0;
   lightColor  = "1 0.5 0.0";

   explodeOnDeath = 1;

   uiName = "Corsair Bomb"; //naming it this way so it's next to the rocket in the alphabetized list
};


datablock ParticleData(CorsairTrailParticle)
{
	dragCoefficient		= -50.0;
	windCoefficient		= -70.0;
	gravityCoefficient	= 0.0;
	inheritedVelFactor	= 300.0;
	constantAcceleration	= 300.0;
	lifetimeMS		= 500;
	lifetimeVarianceMS	= 0;
	spinSpeed		= 10.0;
	spinRandomMin		= -50.0;
	spinRandomMax		= 50.0;
	useInvAlpha		= false;
	animateTexture		= false;
	//framesPerSec		= 1;

	textureName		= "base/data/particles/dot";
	//animTexName		= "~/data/particles/dot";

	// Interpolation variables
	colors[0]	= "1 1 0.3 1";
	colors[1]	= "1 0.9 0.6 1";
	colors[2]	= "0.8 0.8 0.8 0";
	sizes[0]	= 0.0;
	sizes[1]	= 1.2;
	sizes[2]	= 0.0;
	times[0]	= 0.0;
	times[1]	= 0.5;
	times[2]	= 0.7;
};

datablock ParticleEmitterData(CorsairTrailEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 0;

   ejectionVelocity = 0.0; //0.25;
   velocityVariance = 0.0; //0.10;

   ejectionOffset = 0;

   thetaMin         = 0.0;
   thetaMax         = 90.0;  

   particles = CorsairTrailParticle;

   useEmitterColors = true;
};


datablock ProjectileData(CorsairTracerProjectile)
{
   directDamage        = 0;
   directDamageType    = $DamageType::Gun;
   radiusDamageType    = $DamageType::Gun;

   brickExplosionRadius = 0;
   brickExplosionImpact = true;          //destroy a brick if we hit it directly?
   brickExplosionForce  = 10;
   brickExplosionMaxVolume = 1;          //max volume of bricks that we can destroy
   brickExplosionMaxVolumeFloating = 2;  //max volume of bricks that we can destroy if they aren't connected to the ground

   impactImpulse	     = 100;
   verticalImpulse	  = 50;
//explosion           = gunExplosion;
   particleEmitter     = "CorsairTrailEmitter";

   muzzleVelocity      = 200;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 200;
   fadeDelay           = 50;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.10;
   isBallistic         = true;
   gravityMod = 0.0;

   hasLight    = false;
   lightRadius = 3.0;
   lightColor  = "0 0 0.5";
};


datablock ParticleData(CorsairMGExplosionParticle)
{
	dragCoefficient      = 8;
	gravityCoefficient   = 0;
	inheritedVelFactor   = 0.2;
	constantAcceleration = 0.0;
	lifetimeMS           = 600;
	lifetimeVarianceMS   = 100;
	textureName          = "base/data/particles/cloud";
	spinSpeed		= 10.0;
	spinRandomMin		= -50.0;
	spinRandomMax		= 50.0;
	colors[0]     = "0 0 0 1";
	colors[1]     = "0 0 0 0";
	sizes[0]      = 2;
	sizes[1]      = 5;

	useInvAlpha = true;
};
datablock ParticleEmitterData(CorsairMGExplosionEmitter)
{
   ejectionPeriodMS = 15;
   periodVarianceMS = 0;
   ejectionVelocity = 2;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "CorsairMGExplosionParticle";

   useEmitterColors = true;

};


datablock ParticleData(CorsairMGExplosionRingParticle)
{
	dragCoefficient      = 8;
	gravityCoefficient   = -0.5;
	inheritedVelFactor   = 0.2;
	constantAcceleration = 0.0;
	lifetimeMS           = 50;
	lifetimeVarianceMS   = 35;
	textureName          = "base/data/particles/star1";
	spinSpeed		= 500.0;
	spinRandomMin		= -500.0;
	spinRandomMax		= 500.0;
	colors[0]     = "1 1 0.0 0.9";
	colors[1]     = "0.9 0.0 0.0 0.0";
	sizes[0]      = 2.5;
	sizes[1]      = 0;

	useInvAlpha = false;
};
datablock ParticleEmitterData(CorsairMGExplosionRingEmitter)
{
	lifeTimeMS = 50;

   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "CorsairMGExplosionRingParticle";

   useEmitterColors = true;
};

datablock ExplosionData(CorsairMGExplosion)
{
   //explosionShape = "";
	soundProfile = CorsairBulletHit;

   lifeTimeMS = 150;

   particleEmitter = CorsairMGExplosionEmitter;
   particleDensity = 5;
   particleRadius = 0.2;

   emitter[0] = CorsairMGExplosionRingEmitter;

   faceViewer     = true;
   explosionScale = "1 1 1";

   shakeCamera = false;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 10.0;

   // Dynamic light
   lightStartRadius = 2;
   lightEndRadius = 2;
   lightStartColor = "0.5 0.8 0.9";
   lightEndColor = "0 0 0";
};

datablock ProjectileData(CorsairMGExplosionProjectile)
{
   directDamage        = 0;
   radiusDamage        = 0;
   damageRadius        = 0;
   explosion           = CorsairMGExplosion;

   explodeOnDeath		= 1;

   armingDelay         = 0;
   lifetime            = 10;
};





datablock ParticleData(CorsairMGSmokeParticle)
{
	dragCoefficient      = 3;
	gravityCoefficient   = 0.5;
	inheritedVelFactor   = 0.2;
	constantAcceleration = 0.0;
	lifetimeMS           = 200;
	lifetimeVarianceMS   = 55;
	textureName          = "base/data/particles/cloud";
	spinSpeed		= 10.0;
	spinRandomMin		= -500.0;
	spinRandomMax		= 500.0;
	colors[0]     = "0.5 0.5 0.5 0.1";
	colors[1]     = "0.5 0.5 0.5 0.0";
	sizes[0]      = 1.00;
	sizes[1]      = 3;

	useInvAlpha = false;
};
datablock ParticleEmitterData(CorsairMGSmokeEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 10;
   velocityVariance = 2;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "CorsairMGSmokeParticle";

   uiName = "Corsair MG Smoke";
};

//This one is taken from Bushido's Combat Biplane script
datablock ParticleData(CorsairShotParticle)
{
    dragCoefficient      = 0;
    gravityCoefficient   = -0.5;
    inheritedVelFactor   = 0.2;
    constantAcceleration = 0.0;
    lifetimeMS           = 40;
    lifetimeVarianceMS   = 0;
    textureName          = "base/data/particles/star1";
    spinSpeed        = 10.0;
    spinRandomMin        = -500.0;
    spinRandomMax        = 500.0;

    colors[0]     = "0.9 0.9 0 0.3";
    colors[1]     = "1 0.5 0.2 0.5";
    colors[2]     = "1 0.5 0.2 0.0";

    sizes[0]      = 1.5;
   sizes[1]      = 0.80;
    sizes[2]      = 0.10;

   times[0] = 0.0;
   times[1] = 0.1;
   times[2] = 1.0;

    useInvAlpha = false;
};
datablock ParticleEmitterData(CorsairShotEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 0;
   ejectionVelocity = 106.0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 1;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "CorsairShotParticle";
};


//Nearly everything down from here is taken quite directly from Bushido's combat biplane script, only slightly edited by me
datablock ShapeBaseImageData(CorsairMGLeftImage : gunImage)
{
   shapeFile = "base/data/shapes/empty.dts";

   mountPoint = 1;

   stateTimeoutValue[2] = 0.040;
   stateSound[2] = CorsairShotSound;
   stateEmitter[2] = CorsairShotEmitter;

   stateEmitter[3] = CorsairMGSmokeEmitter;
   stateTransitionOnTimeout[3] = "Ready";

    casing = GunShellDebris;
    shellExitDir        = "0 -3 -2.6";
    shellExitOffset     = "0 -5 -5";
    shellExitVariance   = 15.0;    
    shellVelocity       = 7.0;


   raycastWeaponRange = 300;
   raycastSpreadAmt = 0.0028;
   raycastSpreadCount = 1;
   raycastWeaponTargets = $TypeMasks::PlayerObjectType | $TypeMasks::StaticObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::FXBrickObjectType;
   raycastExplosionProjectile = CorsairMGExplosionProjectile;
   raycastExplosionBrickSound = gunHitSound;
   raycastExplosionPlayerSound = gunHitSound;
   raycastDirectDamage = 10;
   raycastDirectDamageType = CorsairDirect;
   raycastExplosionSound = gunHitSound;
   raycastTracerProjectile = CorsairTracerProjectile;
   raycastFromMuzzle = true;
};

datablock ShapeBaseImageData(CorsairMGRightImage : CorsairMGleftImage)
{
   stateTimeoutValue[2] = 0.040;

   raycastWeaponRange = 300;
   raycastSpreadAmt = 0.0015;
   raycastSpreadCount = 1;
   raycastDirectDamage = 10;

   mountPoint = 2;
};



datablock ShapeBaseImageData(CorsairBombImage : rocketLauncherImage)
{
   shapeFile = "base/data/shapes/empty.dts";

   mountPoint = 3;

   projectile = CorsairBombProjectile;

	stateName[0]                     = "Activate";
	stateTimeoutValue[0]             = 0.1;
	stateTransitionOnTimeout[0]       = "Ready";
	//stateSound[0]					= weaponSwitchSound;

	stateName[1]                     = "Ready";
	stateTransitionOnTriggerDown[1]  = "Fire";
	stateAllowImageChange[1]         = true;
   stateTransitionOnNoAmmo[1]       = "NoAmmo";
	stateSequence[1]	= "Ready";
	stateScript[1]                  = "OnReady";

	stateName[2]                    = "Fire";
	stateTransitionOnTimeout[2]     = "Smoke";
	stateTimeoutValue[2]            = 0.1;
	stateFire[2]                    = true;
	stateAllowImageChange[2]        = false;
	stateSequence[2]                = "Fire";
	stateScript[2]                  = "onFire";
	stateWaitForTimeout[2]			= true;
	stateEmitter[2]					= "";
	//stateEmitter[2]					= rocketLauncherFlashEmitter;
	//stateEmitterTime[2]				= 0.05;
	//stateEmitterNode[2]				= tailNode;
	stateSound[2]					= CorsairBombDropSound;
   stateSequence[2]                = "Fire";
	//stateEjectShell[2]       = true;

	stateName[3] = "Smoke";
	//stateEmitter[3]					= rocketLauncherSmokeEmitter;
	//stateEmitterTime[3]				= 0.05;
	//stateEmitterNode[3]				= "muzzleNode";
	stateTimeoutValue[3]            = 0.1;
   stateSequence[3]                = "TrigDown";
	stateTransitionOnTimeout[3]     = "CoolDown";

   stateName[5] = "CoolDown";
   stateTimeoutValue[5]            = 10;
	stateTransitionOnTimeout[5]     = "Reload";
   stateSequence[5]                = "TrigDown";


	stateName[4]			= "Reload";
	stateTransitionOnTriggerUp[4]     = "Ready"; //NoAmmo
	stateSequence[4]	= "TrigDown";

   stateName[6]   = "NoAmmo";
   stateTransitionOnAmmo[6] = "Ready"; //NoAmmo
};
